jQuery(document).ready(function($) {
	$('#contact').contactable({subject: 'Design Chemical Online Contact Form'});
	$('#contact-banner').click(function(e){
		if($('div#contactable').hasClass('active')){
		$('div#contactable').removeClass('active').animate({"marginLeft": "-=387px"}, "slow").animate({"marginLeft": "+=5px"}, "fast"); 
		$('#contactForm').animate({"marginLeft": "-=390px"}, "slow");
		} else {
		$('div#contactable').addClass('active');
		$('div#contactable').animate({"marginLeft": "-=5px"}, "fast"); 
		$('#contactForm').animate({"marginLeft": "-=0px"}, "fast");
		$('div#contactable').animate({"marginLeft": "+=387px"}, "slow"); 
		$('#contactForm').animate({"marginLeft": "+=390px"}, "slow");
		}
		e.preventDefault();
	});
	$('.email').nospam({replaceText: true, filterLevel: 'normal'});
	var content = $(".email");
    content.load("/emailaddress.htm");
	$('a[rel*=external]').click(function(){
		this.target = "_blank";
	});
	$(".img-swap").hover(
          function(){this.src = this.src.replace("_off","_on");},
          function(){this.src = this.src.replace("_on","_off");
     });
	$('.demo').each(function(){
		var linkText = $(this).text();
		linkText = '<span>'+linkText+'</span>';
		$(this).empty().append(linkText);
	});
	jQuery('#nav-main-mega').dcMegaMenuCustom({
        rowItems: '4',
        speed: 'fast',
		effect: 'fade',
		subPad: 170
    });
	
  var currentPosition = 0;
  var slideWidth = 402;
  var slides = $('#slide li');
  var numberOfSlides = slides.length;
  slides.wrapAll('<div id="slideInner"></div>').css({'float' : 'left','width' : slideWidth});
  $('#slideInner').css('width', slideWidth * numberOfSlides);
  $('#slide-links ul li a').hover(function(){
	if(!$('#slide-links').hasClass('slide-static')){
		$('#slide-links ul li').removeClass('links-hover');
		var ind = $(this).index('#slide-links ul li a');
		$(this).parent().addClass('links-hover');
		$('#slideInner').stop().animate({'marginLeft' : slideWidth*(-ind)});
	}
  });
  $('#slide-links ul li a').click(function(){
	$('#slide-links').addClass('slide-static');
  });
});

function defaulttextFunction(){
			$(".defaultText").focus(function(srcc) {
				if ($(this).val() == $(this)[0].title) {
					$(this).removeClass("defaultTextActive");
					$(this).val("");
				}
			});
			$(".defaultText").blur(function() {
				if ($(this).val() == "") {
					$(this).addClass("defaultTextActive");
					$(this).val($(this)[0].title);
				}
			});
			$(".defaultText").addClass("defaultTextActive").blur();
		}